package com.ssy.lingxi.purchase.controller.notice;

import com.ssy.lingxi.common.controller.BaseController;
import com.ssy.lingxi.common.response.PageData;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.purchase.api.dto.request.CommonIdRequest;
import com.ssy.lingxi.purchase.api.dto.request.PurchaseNoticeListRequest;
import com.ssy.lingxi.purchase.api.dto.response.PurchaseNoticeResponse;
import com.ssy.lingxi.purchase.service.notice.PurchaseNoticeService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;

/**
 * @menu 企业直采 - 采购公示
 * @author fhj
 * @version 2.0.0
 * @date 2021/05/26
 */
@RestController
@RequestMapping("/purchase/purchase/notice")
public class PurchaseNoticeController extends BaseController {

    @Resource
    private PurchaseNoticeService purchaseNoticeService;

    @ApiOperation(value = "列表")
    @GetMapping(value = "/list")
    public Wrapper<PageData<PurchaseNoticeResponse>> list(@Valid PurchaseNoticeListRequest qo) {
        Long shopId = getHeadersShopId();
        return purchaseNoticeService.list(qo, isLogin() ? getSysUser() : null,shopId);
    }

    @ApiOperation(value = "详情")
    @GetMapping(value = "/details")
    public Wrapper<PurchaseNoticeResponse> details(@Valid CommonIdRequest dto, HttpServletRequest request) {
        return purchaseNoticeService.details(dto);
    }
}
